package com.aaa.vegetablemarketexpress.dao;

import com.aaa.vegetablemarketexpress.entity.OrderItem;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @FileName: OrderItemDao
 * @Description: 订单明细DAO
 * @Author: qxh
 * @CreateTime: 2025/9/15 15:37
 * @Version: 1.0.0
 */
@Mapper
public interface OrderItemDao {

    /**
     * 插入订单明细
     * @param orderItem 订单明细信息
     * @return 插入结果
     */
    int insertOrderItem(OrderItem orderItem);
    /**
     * 根据ID查询订单项
     * @param itemId 订单项ID
     * @return 订单项信息
     */
    OrderItem selectOrderItemById(@Param("itemId") Long itemId);

    /**
     * 更新订单项
     * @param orderItem 订单项信息
     * @return 更新结果
     */
    int updateOrderItem(OrderItem orderItem);
    /**
     * 根据订单ID查询订单项列表
     * @param orderId 订单ID
     * @return 订单项列表
     */
    List<OrderItem> selectOrderItemsByOrderId(@Param("orderId") Long orderId);

    /**
     * 根据订单ID和用户ID查询订单项列表
     * @param orderId 订单ID
     * @param customerId 用户ID
     * @return 订单项列表
     */
    List<OrderItem> selectOrderItemsByOrderIdAndCustomerId(@Param("orderId") Long orderId, @Param("customerId") Long customerId);

}
